﻿using NETCore.Encrypt;
using System;
using System.Collections.Generic;
using System.Text;

namespace TL_Cloud.Utils
{
   
    /// <summary>
    /// DES加密与解密
    /// 敏感数据存储过程泄密
    /// </summary>
    public class DESHelper
    {
        private readonly string desKey;

        public DESHelper(string desKey)
        {
            if (string.IsNullOrEmpty(desKey))
            {
                throw new ArgumentException("message", nameof(desKey));
            }
            this.desKey = desKey;
        }  
        /// <summary>
        /// 加密
        /// </summary>
        /// <param name="content"></param>
        /// <returns></returns>
        public string Encrypt(string content)
        {
           return EncryptProvider.DESEncrypt(content, desKey);
        }

        public string Decrypt(string content)
        {
            return EncryptProvider.DESDecrypt(content, desKey);
        }
    }
 
}
